package TDAMap;

public class MapeoFrecuencias extends OpenHashListMap<String,Integer> {
	
	// Constructor
	
	public MapeoFrecuencias () {
		super();
	}

	public Integer put (String key) throws InvalidKeyException {
		checkKey(key);
		if (size/capacidad>0.5)
			reSize();
		Entrada<String,Integer> e = buscar(key);
		if (e == null) {
			listas[hashValue(key)].addLast(new Entrada<String,Integer>(key,1));
			size++;
			return 1;
		}
		else {
			Integer toReturn = e.getValue()+1;
			e.setValue(toReturn);
			return toReturn;
	    }
	}

}
